import React from 'react'
import { Swiper } from 'antd-mobile'
import { useRef } from 'react'

// 定义轮播图组件
export default function MySwiper(props, ref) {
  const {swiperList,changeVisibelFn}=props
  return (
      swiperList.length > 0 ?
        <Swiper autoplay 
        >
          {
            swiperList.map((item,index) => {
              return <Swiper.Item key={item.bannerid} onClick={ ()=>{
                changeVisibelFn(index)//点击显示图片预览,
              }}>
                <img src={item.img} style={{
                  width: '100%'
                }}/>
              </Swiper.Item>
            })
          }
        </Swiper> : <></>
  )
}
